package de.szut.invaders.view;

import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
  
public class GameFrame extends JFrame {
	
	private static GameFrame instance;
	
	public static GameFrame getInstance() {
		if (instance == null) {
			instance = new GameFrame();
		}
		return instance;
	}
	
	private GameFrame() {
		setTitle("Space Invaders");
		setLayout(null);
		setDefaultCloseOperation(DO_NOTHING_ON_CLOSE);
		setBounds(100, 100, 528, 643);
		setResizable(false);
		addKeyListener(new GameListener());
		addWindowListener(new FrameListener());
		setVisible(true);
	}
	
	public void setPanel(JPanel panel) {
		
	}
	
	public void showClosingWindow() {
		String[] options = {"Fortsetzen", "Speichern", "Beenden"};
		int selection = JOptionPane.showOptionDialog(null, "Wirklich beenden?", "Beenden",
				JOptionPane.DEFAULT_OPTION, JOptionPane.INFORMATION_MESSAGE, null, options, options[0]);
		switch(selection) {
			case(1): {
				//Speichern
			}
			case (2): {
				System.exit(0);
			}
		}
	}
}
